<%@page import="org.hibernate.validator.constraints.SafeHtml.Tag" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%String path = request.getContextPath();%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="renderer" content="webkit">
    <c:set var="ctx" value="${pageContext.request.contextPath}"/>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>新增/修改法人信息</title>
    <jsp:include page="../../import.jsp" flush="true"/>
    <style type="text/css">
        .td {
            height: 30px;
            text-align: center;
            width: 18%;
        }

        .td div input, select {
            width: 66%;
            -moz-border-radius: 5px;
            -webkit-border-radius: 5px;
            -ms-border-radius: 5px;
            -khtml-border-radius: 5px;
            border-radius: 5px;
        }

    </style>
</head>
<body class="iframeBody">
<div class="Wrapper">
    <div>
        <div id="pageInTab" class="pageInTab">
            <div tabid="tabA" title="基本信息" lselected="true">
                <form id="formSet1">
                    <div class="fieldset1 tabel_col clearFix">
                        <div class="caption">
                            <span class="title">基本信息</span>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">客户类型</div>
                            <div class="field">
                                <span class="requiredSymbol">法人</span>
                                <!--  <input type="radio" value="2" name="customerTYPE" checked /> 企业
                                 <input type="radio" value="1" name="customerTYPE" /> 自然人 -->
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">企业名称</div>
                            <div class="field">
                                <input name="cstNm" id="cstNm" type="text" class="ui-textbox" value="${cstNm }"
                                       disabled="disabled" validate="{required:true,maxlength:50}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">客户关系</div>
                            <div class="field test_combo">
                                <input name="cstRlTyp" id="cstRlTyp" type="text" ltype="combobox" placeholder="请选择"
                                       validate="{required:true}"></input>
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">证件类型</div>
                            <div class="field">
                                <select name="certTypCd" id="certTypCd" data-value="${certTypCd }" disabled="disabled">
                                    <c:forEach items="${searchSelectCertTypCdList }" var="kv" begin="0" step="1"
                                               varStatus="status">
                                        <c:if test="${status.index == 0}">
                                            <option value="${kv.key }" selected>${kv.value }</option>
                                        </c:if>
                                        <c:if test="${status.index != 0}">
                                            <option value="${kv.key }">${kv.value }</option>
                                        </c:if>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">证件号码</div>
                            <div class="field">
                                <input name="certNo" id="certNo" type="text" class="ui-textbox" value="${certNo }"
                                       disabled="disabled" validate="{required:true,maxlength:30}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">营业执照注册号</div>
                            <div class="field">
                                <input name="bizLicNo" id="bizLicNo" type="text" class="ui-textbox" value=""
                                       validate="{required:true,checkBizLicNo:true}">
                                <span class="requiredSymbol" id="bizLicNoRequiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">中征码</div>
                            <div class="field">
                                <input name="loanCardCd" id="loanCardCd" type="text" class="ui-textbox" value=""
                                       validate="{required:true,maxlength:16}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">法定代表人</div>
                            <div class="field">
                                <input name="lowerCstNm" id="lowerCstNm" type="text" class="ui-textbox"
                                       value="${lowerCstNm }" disabled="disabled"
                                       validate="{required:true,nmcharacter:true,maxlength:50}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">证件类型</div>
                            <div class="field">
                                <select name="corpForCertTypCd" id="corpForCertTypCd" data-value="${corpForCertTypCd }"
                                        validate="{required:true, select: true}">
                                    <c:forEach items="${searchSelectCertTypCdForNpList }" var="kv" begin="0" step="1"
                                               varStatus="status">
                                        <c:if test="${status.index == 0}">
                                            <option value="${kv.key }" checked>${kv.value }</option>
                                        </c:if>
                                        <c:if test="${status.index != 0}">
                                            <option value="${kv.key }">${kv.value }</option>
                                        </c:if>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33" style="display:none">
                            <div class="label">证件类型</div>
                            <div class="field">
                                <select name="tcorpForCertTypCd" id="tcorpForCertTypCd">
                                    <c:forEach items="${searchSetlectCertTypCdForNpList }" var="kv" begin="0" step="1"
                                               varStatus="status">
                                        <c:if test="${status.index == 0}">
                                            <option value="${kv.key }" checked>${kv.value }</option>
                                        </c:if>
                                        <c:if test="${status.index != 0}">
                                            <option value="${kv.key }">${kv.value }</option>
                                        </c:if>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">代表人身份证号码</div>
                            <div class="field">
                                <input name="lowerCertNo" id="lowerCertNo" type="text" class="ui-textbox"
                                       value="${lowerCertNo }" disabled="disabled"
                                       validate="{required:true,nmcharacter:true,maxlength:50}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">企业简称</div>
                            <div class="field">
                                <input name="shtNm" id="shtNm" type="text" class="ui-textbox" value=""
                                       validate="{required:false,maxlength:50}">
                            </div>
                        </div>
                        <!-- <div class="fieldBox col_33">
                            <div class="label">统一社会信用代码</div>
                            <div class="field">
                                <input name="succ" id="succ" type="text" class="ui-textbox" value="" validate="{maxlength:20}">
                            </div>
                        </div> -->
                        <div class="fieldBox col_33">
                            <div class="label">企业性质</div>
                            <div class="field">
                                <select name="corpTypCd" id="corpTypCd" data-value="">
                                    <c:forEach items="${searchSelectCorpTypCdList }" var="kv" begin="0" step="1"
                                               varStatus="status">
                                        <c:if test="${status.index == 0}">
                                            <option value="${kv.key }" checked>${kv.value }</option>
                                        </c:if>
                                        <c:if test="${status.index != 0}">
                                            <option value="${kv.key }">${kv.value }</option>
                                        </c:if>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">注册资本金</div>
                            <div class="field" style="margin-right: 5px;">
                                <input name="regCapAmt" id="regCapAmt" type="text" class="ui-textbox" value=""
                                       ligerui="width: 110" validate="{required:true, digits:true, maxlength:20}">
                                <select name="regCapUntCd" id="regCapUntCd" ligerui="width: 60" data-value="">
                                    <c:forEach items="${searchSelectRegCapUntCdList }" var="kv" begin="0" step="1"
                                               varStatus="status">
                                        <c:if test="${status.index == 0}">
                                            <option value="${kv.key }" checked>${kv.value }</option>
                                        </c:if>
                                        <c:if test="${status.index != 0}">
                                            <option value="${kv.key }">${kv.value }</option>
                                        </c:if>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">实收资本金</div>
                            <div class="field" style="margin-right: 5px;">
                                <input name="paidCapAmt" id="" paidCapAmt"" type="text" class="ui-textbox" value=""
                                ligerui="width: 110" validate="{required:false, digits:true, maxlength:20}">
                                <select name="paidCapUntCd" id="paidCapUntCd" ligerui="width: 60" data-value="">
                                    <c:forEach items="${searchSelectPaidCapUntCdList }" var="kv" begin="0" step="1"
                                               varStatus="status">
                                        <c:if test="${status.index == 0}">
                                            <option value="${kv.key }" checked>${kv.value }</option>
                                        </c:if>
                                        <c:if test="${status.index != 0}">
                                            <option value="${kv.key }">${kv.value }</option>
                                        </c:if>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">成立日期</div>
                            <div class="field">
                                <input name="regDt" id="regDt" type="text" class="ui-datepicker" value=""
                                       validate="{required:true}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">营业期限至</div>
                            <div class="field">
                                <input name="expDt" id="expDt" type="text" class="ui-datepicker" value=""
                                       validate="{required:true}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">税务登记证</div>
                            <div class="field">
                                <input name="taxRegNo" id="taxRegNo" type="text" class="ui-textbox" value=""
                                       validate="{required:true,checkTaxRegNo:true}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">企业传真</div>
                            <div class="field">
                                <input name="corpTax" id="corpTax" type="text" class="ui-textbox" value=""
                                       validate="{numberAndMiddleLine:true,maxlength:30}">
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">注册电话</div>
                            <div class="field">
                                <input name="regTel" id="regTel" type="text" class="ui-textbox" value=""
                                       validate="{required:false, fixedPhone: true}">
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">办公电话</div>
                            <div class="field">
                                <input name="officeTel" id="officeTel" type="text" class="ui-textbox" value=""
                                       validate="{required:true, fixedPhone: true}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <!-- <div class="fieldBox col_33">
                            <div class="label">通讯地址邮编</div>
                            <div class="field">
                                <input name="zipNo" id="zipNo" type="text" class="ui-textbox" value="" validate="{required:false, zipCode:true}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div> -->

                        <div class="fieldBox col_33">
                            <div class="label">办公用房使用权面积</div>
                            <div class="field">
                                <input name="officeArea" id="officeArea" type="text" class="ui-textbox"
                                       ligerui="width: 110" value=""
                                       validate="{decimal:true, digits:true, maxlength:20}">
                                <span class="requiredSymbol">平方米</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">房产属性</div>
                            <div class="field">
                                <input name="prpAttr" id="prpAttr" type="text" class="ui-textbox" value=""
                                       validate="{maxlength:50}">
                            </div>
                        </div>
                        <!-- <div class="fieldBox col_33">
                             <div class="label">贷款卡号</div>
                             <div class="field">
                                 <input name="loanCardNo" id="loanCardNo" type="text" class="ui-textbox" value="" validate="{number:true,maxlength:30}">
                             </div>
                         </div>
                         <div class="fieldBox col_33">
                             <div class="label">贷款卡密码</div>
                             <div class="field">
                                 <input name="loanCardPwd" id="loanCardPwd" type="text" class="ui-textbox" value="" validate="{maxlength:10}">
                             </div>
                         </div> -->
                        <div id="cstGuarDynamicBizdiv">
                            <%-- <jsp:include page="../cstdynamic/cstGuarDynamicPage.jsp"></jsp:include> --%>
                        </div>

                        <div id="cstGuar1DynamicBizdiv">
                            <%-- dynamic1  field --%>
                        </div>

                        <div class="fieldBox col_33">
                            <div class="label">是否事业单位</div>
                            <div class="field">
                                <select name="isInst" id="isInst" data-value="" validate="{required:true}">
                                    <c:forEach items="${yNList }" var="kv" begin="0" step="1" varStatus="status">
                                        <c:if test="${status.index == 0}">
                                            <option value="${kv.key }" checked>${kv.value }</option>
                                        </c:if>
                                        <c:if test="${status.index != 0}">
                                            <option value="${kv.key }">${kv.value }</option>
                                        </c:if>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">开户许可证核准号</div>
                            <div class="field">
                                <input name="perMitNo" id="perMitNo" type="text" class="ui-textbox" value=""
                                       validate="{minlength:14,maxlength:14,checkPerMitNo:true}">
                            </div>
                        </div>
                        <!-- <div class="fieldBox col_33">
                            <div class="label">贷款卡编码</div>
                            <div class="field">
                                <input name="loanCardCd" id="loanCardCd" type="text" class="ui-textbox" value="" validate="{required:false, maxlength:30}">
                            </div>
                        </div> -->
                        <div class="fieldBox col_33">
                            <div class="label">还款方式</div>
                            <div class="field">
                                <select name="payTypCd" id="payTypCd" data-value=""
                                        validate="{required:false, select: false}">
                                    <option value="">请选择</option>
                                    <c:forEach items="${payTyplist }" var="kv">
                                        <option value="${kv.key }">${kv.value }</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">所属行业</div>
                            <div class="field">
                                <input name="indCd" id="indCd" type="text" class="ui-textbox" value="" ltype="combobox"
                                       validate="{required:true, select: false}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">经济行业分类</div>
                            <div class="field">
                                <input name="stdIndCd" id="stdIndCd" type="text" class="ui-textbox" value=""
                                       ltype="combobox" validate="{required:true, maxlength:30}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>

                        <div class="fieldBox col_33">
                            <div class="label">立项控制</div>
                            <div class="field">
                                <select name="prjCtrlCd" id="prjCtrlCd" data-value=""
                                        validate="{required:false, select: false}">
                                    <option value="">请选择</option>
                                    <c:forEach items="${prjCtrlCdList }" var="kv">
                                        <option value="${kv.key }">${kv.value }</option>
                                    </c:forEach>
                                </select>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">房产价值</div>
                            <div class="field">
                                <input name="prpVal" id="prpVal" type="text" class="ui-textbox" value=""
                                       validate="{required:false, maxlength:50}">
                            </div>
                        </div>
                        <ui:normalSelect pgCd="custCorpPage" cmpCd="custPageMainForm" cmpDtlCd="cstLvlCd"
                                         orgCds="${orgCds }"></ui:normalSelect>
                        <!-- <div class="fieldBox col_33 Hide" id="othIndCdDiv">
                           <div class="label">所属其他行业</div>
                           <div class="field">
                               <input name="othIndCd" id="othIndCd" type="text" class="ui-textbox" value="" validate="{maxlength:50}">
                           </div>
                        </div> -->
                        <!-- 标准区域 -->
                        <jsp:include page="../../system/sysRegion/sysStdRegion.jsp" flush="true">
                            <jsp:param name="sysStdRegionDefShowLvl" value="3"/>
                            <jsp:param name="sysStdRegionProvCdNm" value="注册地行政区划-省份"/>
                            <jsp:param name="sysStdRegionCityCdNm" value="城市"/>
                            <jsp:param name="sysStdRegionDistCdNm" value="区\\县"/>
                        </jsp:include>
                        <div class="fieldBox col_33" style="display:none">
                            <div class="label">成员类型</div>
                            <div class="field">
                                <select name="mTypCd" id="mTypCd" data-value=""
                                        validate="{required:true, select: true}">
                                    <c:forEach items="${searchSelectMTypCdList }" var="kv" begin="0"
                                               step="1" varStatus="status">
                                        <c:if test="${kv.key != 1}">
                                            <c:if test="${status.index == 0}">
                                                <option value="${kv.key }" checked>${kv.value }</option>
                                            </c:if>
                                            <c:if test="${status.index != 0}">
                                                <option value="${kv.key }">${kv.value }</option>
                                            </c:if>
                                        </c:if>
                                    </c:forEach>
                                </select>
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <!-- <div class="fieldBox col_33">
                            <div class="label">成员姓名</div>
                            <div class="field">
                                <input name="teamNm" id="teamNm" type="text" class="ui-textbox" value=""
                                    validate="{required:true,nmcharacter:true,maxlength:20}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_33">
                            <div class="label">身份证号</div>
                            <div class="field">
                                <input name="teamCertNo" id="teamCertNo" type="text" class="ui-textbox"
                                    value="" validate="{required:true, maxlength:30 }">
                                    <span class="requiredSymbol">*</span>
                            </div>
                        </div> -->
                        <div class="fieldBox col_100">
                            <div class="label">经营范围</div>
                            <div class="field">
                                <input name="bizScope" id="bizScope" type="text" class="ui-textbox" value=""
                                       validate="{maxlength:250}">
                            </div>
                        </div>
                        <div class="fieldBox col_100">
                            <div class="label">注册地址</div>
                            <div class="field">
                                <input name="regAddr" id="regAddr" type="text" class="ui-textbox" value=""
                                       validate="{required:true,maxlength:120}">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_100">
                            <div class="label">通讯地址</div>
                            <div class="field">
                                <input name="postAddr" id="postAddr" type="text" class="ui-textbox" value=""
                                       validate="{required:true,maxlength:120}"
                                       placeholder="请填写邮件接收地址，如未填写将默认注册地址为实际通讯地址">
                                <span class="requiredSymbol">*</span>
                            </div>
                        </div>
                        <div class="fieldBox col_100">
                            <div class="label">贷款事项约定</div>
                            <div class="field" style="width: 100%;">
                                <textarea name="loanAss" id="loanAss" rows="4" class="l-textarea" style="width:99%"
                                          validate="{maxlength:200}"></textarea>
                            </div>
                        </div>
                        <div class="fieldBox col_100">
                            <div class="label">备注</div>
                            <div class="field" style="width: 100%;">
                                <textarea name="cstRem" id="cstRem" rows="4" class="l-textarea" style="width:99%"
                                          validate="{maxlength:200}"></textarea>
                            </div>
                        </div>
                    </div>

                    <div class="sqPanel">
                        <div class="sqPanel_head inL">
                            <div class="btnsBox inLC">
                                <span id="cst_corp_team_add_btn_id" class="sq-button sq-button-round">添加</span>
                            </div>
                            <span>主要团队成员</span>
                        </div>
                        <div class="sqPanel_body">
                            <!-- <div id="ligergrid_members" class="sq-grid"></div> -->
                            <table style="BORDER-COLLAPSE: collapse;margin-bottom:20px" borderColor=#ECECEC height=40
                                   cellPadding=1 width="100%" align=center border=1>
                                <thead>
                                <tr style="background:#E7FEF4">
                                    <td class="td">职务</td>
                                    <td class="td">姓名</td>
                                    <td class="td">证件类型</td>
                                    <td class="td">证件号</td>
                                    <td class="td">电话</td>
                                    <td class="td">操作</td>
                                </tr>
                                </thead>
                                <tbody id="rows">
                                <c:choose>
                                    <c:when test="${id != null}">
                                        <c:forEach items="${teamMenList}" var="item">
                                            <tr>
                                                <td style="display:none">
                                                    <input name="teamId" id="teamId" type="text" value="${item.id}">
                                                </td>
                                                <td class="td">
                                                    <div>
                                                        <c:choose>
                                                            <c:when test="${item.mTypCd == 1 || item.mTypCd == 7 || item.mTypCd == 10}">
                                                                <select name="mTypCd" id="mTypCd" disabled="disabled">
                                                                    <c:forEach items="${searchSelectMTypCdList }"
                                                                               var="kv">
                                                                        <c:if test="${kv.key == item.mTypCd}">
                                                                            <option value="${kv.key }">${kv.value }</option>
                                                                        </c:if>
                                                                    </c:forEach>
                                                                </select>
                                                            </c:when>
                                                            <c:otherwise>
                                                                <select name="mTypCd" id="mTypCd">
                                                                    <c:forEach items="${searchSelectMTypCdList }"
                                                                               var="kv">
                                                                        <c:choose>
                                                                            <c:when test="${kv.key == item.mTypCd}">
                                                                                <option value="${kv.key }"
                                                                                        selected="selected">${kv.value }</option>
                                                                            </c:when>
                                                                            <c:otherwise>
                                                                                <option value="${kv.key }">${kv.value }</option>
                                                                            </c:otherwise>
                                                                        </c:choose>
                                                                    </c:forEach>
                                                                </select>
                                                            </c:otherwise>
                                                        </c:choose>
                                                    </div>
                                                </td>
                                                <td class="td">
                                                    <div>
                                                        <input name="teamNm" id="teamNm" type="text"
                                                               value="${item.mNm}">
                                                    </div>
                                                </td>
                                                <td class="td">
                                                    <div>
                                                        <select name="tcorpForCertTypCd" id="tcorpForCertTypCd">
                                                            <c:forEach items="${searchSelectCertTypCdForNpList }"
                                                                       var="kv">
                                                                <c:choose>
                                                                    <c:when test="${kv.key == item.certTypCd}">
                                                                        <option value="${kv.key }"
                                                                                selected="selected">${kv.value }</option>
                                                                    </c:when>
                                                                    <c:otherwise>
                                                                        <option value="${kv.key }">${kv.value }</option>
                                                                    </c:otherwise>
                                                                </c:choose>
                                                            </c:forEach>
                                                        </select>
                                                    </div>
                                                </td>
                                                <td class="td">
                                                    <div>
                                                        <input name="teamCertNo" id="teamCertNo" type="text"
                                                               value="${item.certNo}">
                                                    </div>
                                                </td>
                                                <td class="td">
                                                    <div>
                                                        <input name="teamMp1" id="teamMp1" type="text"
                                                               value="${item.mp1}">
                                                    </div>
                                                </td>
                                                <td class="td">
                                                    <c:if test="${item.mTypCd != 1 && item.mTypCd != 7 && item.mTypCd != 10}">
                                                        <div><a class="sq-button-hasicon" style="cursor:pointer"
                                                                onclick="deleteRow(this)"><i
                                                                class="sqBtnIco_7"></i>删除</a></div>
                                                    </c:if>
                                                </td>
                                            </tr>
                                        </c:forEach>
                                    </c:when>
                                    <c:otherwise>
                                        <tr>
                                            <td class="td">
                                                <div>
                                                    <select name="mTypCd" id="mTypCd" disabled="disabled">
                                                        <option value="1">法人代表</option>
                                                    </select>
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <input name="teamNm" id="teamNm" type="text" initNm="initTeamNm"
                                                           value="">
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <select name="tcorpForCertTypCd" id="tcorpForCertTypCd"
                                                            initTyp="initTyp">
                                                        <c:forEach items="${searchSelectCertTypCdForNpList }" var="kv"
                                                                   begin="0" step="1" varStatus="status">
                                                            <c:if test="${status.index == 0}">
                                                                <option value="${kv.key }" checked>${kv.value }</option>
                                                            </c:if>
                                                            <c:if test="${status.index != 0}">
                                                                <option value="${kv.key }">${kv.value }</option>
                                                            </c:if>
                                                        </c:forEach>
                                                    </select>
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <input name="teamCertNo" id="teamCertNo" type="text"
                                                           initNo="initTeamCertNo" value="">
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <input name="teamMp1" id="teamMp1" type="text" value="">
                                                </div>
                                            </td>
                                            <td class="td">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="td">
                                                <div>
                                                    <select name="mTypCd" id="mTypCd" disabled="disabled">
                                                        <option value="7">总经理</option>
                                                    </select>
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <input name="teamNm" id="teamNm" type="text" value="">
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <select name="tcorpForCertTypCd" id="tcorpForCertTypCd">
                                                        <c:forEach items="${searchSelectCertTypCdForNpList }" var="kv"
                                                                   begin="0" step="1" varStatus="status">
                                                            <c:if test="${status.index == 0}">
                                                                <option value="${kv.key }" checked>${kv.value }</option>
                                                            </c:if>
                                                            <c:if test="${status.index != 0}">
                                                                <option value="${kv.key }">${kv.value }</option>
                                                            </c:if>
                                                        </c:forEach>
                                                    </select>
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <input name="teamCertNo" id="teamCertNo" type="text" value="">
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <input name="teamMp1" id="teamMp1" type="text" value="">
                                                </div>
                                            </td>
                                            <td class="td">
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="td">
                                                <div>
                                                    <select name="mTypCd" id="mTypCd" disabled="disabled">
                                                        <option value="10">财务总监</option>
                                                    </select>
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <input name="teamNm" id="teamNm" type="text" value="">
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <select name="tcorpForCertTypCd" id="tcorpForCertTypCd">
                                                        <c:forEach items="${searchSelectCertTypCdForNpList }" var="kv"
                                                                   begin="0" step="1" varStatus="status">
                                                            <c:if test="${status.index == 0}">
                                                                <option value="${kv.key }" checked>${kv.value }</option>
                                                            </c:if>
                                                            <c:if test="${status.index != 0}">
                                                                <option value="${kv.key }">${kv.value }</option>
                                                            </c:if>
                                                        </c:forEach>
                                                    </select>
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <input name="teamCertNo" id="teamCertNo" type="text" value="">
                                                </div>
                                            </td>
                                            <td class="td">
                                                <div>
                                                    <input name="teamMp1" id="teamMp1" type="text" value="">
                                                </div>
                                            </td>
                                            <td class="td">
                                            </td>
                                        </tr>
                                    </c:otherwise>
                                </c:choose>
                                </tbody>
                            </table>
                        </div>
                    </div>
                    <div class="fieldset1 tabel_col tabel_col_s clearFix">
                        <!-- <div class="caption">
                            <span class="title">辅助信息</span>
                        </div> -->

                        <!-- 企业规模 -->
                        <%-- <ui:normalSelect pgCd="custCorpPage" cmpCd="custCorpPageMainForm" cmpDtlCd="empQtyCd"></ui:normalSelect> --%>
                        <!-- 企业备案网址 -->
                        <%-- <ui:normalInput pgCd="custCorpPage" cmpCd="custCorpPageMainForm" cmpDtlCd="websit"></ui:normalInput> --%>
                        <!-- 所属行业 -->
                        <%-- <ui:normalInput pgCd="custCorpPage" cmpCd="custCorpPageMainForm" cmpDtlCd="indCd"></ui:normalInput>--%>
                        <div class="fieldBox col_100" id="fileModify">
                            <div class="label">资料</div>
                            <div class="field">
                                <jsp:include page="../../system/sysUlFilesRec/sysUlFileRecList.jsp" flush="true">
                                    <jsp:param name="pkId" value="${id }"/>
                                    <jsp:param name="tabNm" value="CST_BSC_INFO"/>
                                </jsp:include>
                            </div>
                        </div>
                        <div class="fieldBox col_100">
                            <div class="label">资料上传</div>
                            <div class="field">
                                <jsp:include page="../../system/sysUlFilesRec/sysSysUlFilesRecUpload2.jsp" flush="true">
                                    <jsp:param name="filePath" value="customer"/>
                                </jsp:include>
                            </div>
                        </div>
                    </div>
                    <div class="btnsBox">
                        <input name="cId" id="cId" type="text" style="display: none;" value="${id}"/>
                        <span id="saveBtn1" class="sq-button sq-button-round">保存</span>
                        <!-- <span id="openLockBtn" class="sq-button sq-button-hasicon"><i class="sqBtnIco_4"></i>解锁</span> -->
                    </div>
                </form>
            </div>
            <div tabid="tabB" title="备案信息">
                <iframe frameborder="0" name="tabB" id="tabB" src=""></iframe>
            </div>
            <div tabid="tabI" title="银行账号" id="tabIId" style="dis">
                <iframe frameborder="0" name="tabI" id="tabI" src=""></iframe>
            </div>
            <div tabid="tabH" title="项目列表">
                <iframe frameborder="0" name="tabH" id="tabH" src=""></iframe>
            </div>
            <!--  <div tabid="tabC" title="资产信息">
                 <iframe frameborder="0" name="tabC" id="tabC" src=""></iframe>
             </div> -->
            <div tabid="tabD" title="征信信息" id="tabDId" style="dis">
                <iframe frameborder="0" name="tabD" id="tabD" src=""></iframe>
            </div>
            <div tabid="tabE" title="财务报表">
                <iframe frameborder="0" name="tabE" id="tabE" src=""></iframe>
            </div>
            <div tabid="tabF" title="中间人">
                <iframe frameborder="0" name="tabF" id="tabF" src=""></iframe>
            </div>
            <div tabid="tabG" title="沟通记录" id="tabGId">
                <iframe frameborder="0" name="tabG" id="tabG" src=""></iframe>
            </div>
            <div tabid="tabK" title="风险标记" id="tabKId">
                <iframe frameborder="0" name="tabK" id="tabK" src=""></iframe>
            </div>

            <div tabid="tabL" title="人工干预" id="tabLId">
                <iframe frameborder="0" name="tabL" id="tabL" src=""></iframe>
            </div>

        </div>
    </div>
</div>

<script>
    var pageInApp = {
        flag: true
    }; // to 下一级子窗口 接口
    var pageInTab = null;
    var loadedTabs = []
    var checkFlag = 0;
    var dataList = "";
    $(function () {
        initCstRlCombox();
        initIndCdTree();//初始化所属行业Tree,要放在form实例化前执行
        initStdIndCdTree();//要放在form实例化前执行
        initData();//修改初始化数据
        initForm();
        initTab();
        selectTab();
        initBtn();
        openLockBtn();
        //disableBeforeItem();
        initEvent();
        disabledField();
    });

    //初始化行业分类树
    var stdIndCdTree;

    function initStdIndCdTree() {
        if ($("#stdIndCd").length <= 0) {
            return;
        }
        ;
        //默认不加载数据,只是初始化而已,这里的数据等所属行业加载完后Set数据到这里
        stdIndCdTree = $("#stdIndCd").ligerComboBox({
            selectBoxWidth: 240,
            selectBoxHeight: 150,
            treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
            tree: {
                //url: '<%=path%>/customer/cstbscinfo/initStdIndCdTree.do',
                ajaxType: 'get',
                checkbox: false,
                parentIcon: "none",
                needCancel: false,
                childIcon: "none",
                onSuccess: function () {
                    stdIndCdInitPass = true;//初始化数据的时候可以赋值
                    /*
                    if(stdIndCd && stdIndCdInitPass == true){//这里和赋值方法里面都有一个赋值,因为在赋值操作和这个下拉框赋值操作是异步的,谁在前谁在后不好说,所以在两个地方根据indCdVal是否存在来赋值数据
                        var treeSelect=liger.get("stdIndCd");
                         if(treeSelect){
                            treeSelect.setValue(stdIndCd);
                         }
                    } */
                }, isDisabled: function (o, outlineLevel) {
                    if (outlineLevel < 2) return true;
                }
            }, onChangeValue: function (value) {
                //var _stdIndCd = liger.get("stdIndCd").getValue();
                //获取第一个字母,设置所属行业的根为这个字母的树
                //reloadIndCdTree(_stdIndCd.charAt(0));
            }
        });
    }

    //初始化所属行业Tree, 这个组件为动态组件, 要做存在判断
    var indCdTree;

    function initIndCdTree() {
        if ($("#indCd").length <= 0) {
            return;
        }
        ;
        //加载数据
        indCdTree = $("#indCd").ligerComboBox({
            selectBoxWidth: 240,
            selectBoxHeight: 150,
            treeLeafOnly: false, //限制只能选叶节点，父节点不能点击
            tree: {
                url: '<%=path%>/customer/cstbscinfo/initIndCdTree.do',
                ajaxType: 'get',
                checkbox: false,
                parentIcon: "none",
                childIcon: "none",
                onSuccess: function () {
                    if (indCdVal) {//这里和赋值方法里面都有一个赋值,因为在赋值操作和这个下拉框赋值操作是异步的,谁在前谁在后不好说,所以在两个地方根据indCdVal是否存在来赋值数据
                        var treeSelect = liger.get("indCd");
                        if (treeSelect) {
                            treeSelect.setValue(indCdVal);
                        }
                    }
                }
            }, onChangeValue: function (value) {
                //一但这里有变化就让其选择经济行业分类
                var _stdIndCd = liger.get("indCd").getValue();
                //通过这个值首字母去找到经济行业分类
                reloadStdIndCdTree(_stdIndCd.charAt(0));
            }
        });
    }

    //根据所属行业选择的数据重新加载经济行业分类数据
    function reloadStdIndCdTree(_pCode) {
        stdIndCdTree.clear();
        var _url = "<%=path%>/customer/cstbscinfo/initStdIndCdTree.do";
        AjaxUtils.ajaxGet(_url, {pCode: _pCode}, function (msg) {
            if (CollectionUtils.isArray(msg)) {
                if (CollectionUtils.isNotEmpty(msg)) {//赋值,否则说明没有返回的数据不处理所属行业的数据,所属行业默认为全部数据
                    //获取所属行业值,然后在setData后在setValue,这样是解决在初始化走这个事件的时候把数据冲掉,有这步(1)后就会在回显上
                    //var _indCd = liger.get("stdIndCd").getValue();//(1)
                    stdIndCdTree.treeManager.setData(msg);
                    //alert(stdIndCd);
                    if (stdIndCd) {//如果这个有值说明初始化已经把值给了变量,这里就可以使用了
                        stdIndCdTree.setValue(stdIndCd);//(1)
                        stdIndCd = null;
                    }
                    stdIndCdTree.clear();
                }
            }
        }, false);
    }

    //新增、修改
    var isAdd = false;//是否新增完成
    var isHaveCstRlTypeDBR = false;

    function initEvent() {
        saveEvent();
        //certNoKeyUpEvent();
    }

    //初始化客户关系类型下拉框
    function initCstRlCombox() {
        var cstRlTypChange = false;//只为了在加载初始化的时候不加载onChangeValue 事件,带前端解决后即可删除
        var _cstRlTypJson = ${cstRlTypCdList};
        var cstRlTypLCB = $("#cstRlTyp").ligerComboBox({
            isShowCheckBox: true,
            isMultiSelect: true,
            data: _cstRlTypJson,
            valueField: 'key',
            textField: 'value',
            onChangeValue: function (value) {
                if (!cstRlTypChange) return;

                var _cstRlTypObj = liger.get("cstRlTyp");
                var _cstRlTypValues = _cstRlTypObj.getValue();
                //如果是担保人则加载
                if (_cstRlTypValues.indexOf(CustomerConstant.CST_RL_TYPE_DBR_CD) != -1 && isHaveCstRlTypeDBR == false) {
                    reloadCstRlTypDBR(CustomerConstant.CST_RL_TYPE_DBR_CD);
                    isHaveCstRlTypeDBR = true;
                } else if (_cstRlTypValues.indexOf(CustomerConstant.CST_RL_TYPE_DBR_CD) == -1 && isHaveCstRlTypeDBR == true) {
                    reloadCstRlTypDBR(-1);
                    isHaveCstRlTypeDBR = false;
                }
                //有担保人的时候部分字段必填项设置：营业执照注册号
                var formSet1 = liger.get("formSet1");
                if (formSet1) {
                    if (_cstRlTypValues.indexOf(CustomerConstant.CST_RL_TYPE_DBR_CD) != -1) {//只是担保人的时候
                        formSet1.setFieldValidate("bizLicNo", {required: false, maxlength: 30});
                        $("#bizLicNoRequiredSymbol").addClass("Hide");
                    } else {//不限制
                        formSet1.setFieldValidate("bizLicNo", {required: true, maxlength: 20});
                        $("#bizLicNoRequiredSymbol").removeClass("Hide");
                    }
                }
            }
        });
        cstRlTypChange = true;
        var _cId = $("#cId").val();
        if (!_cId) {
            var currentCstRlTypeForAdd = ${currentCstRlTypeForAdd};
            $("#cstRlTyp").ligerGetComboBoxManager().setValue(currentCstRlTypeForAdd);//TODO 注意变成常量
            //$("#cstRlTyp").ligerGetComboBoxManager().updateStyle();
        }
    }

    //刷新担保人组件
    function reloadCstRlTypDBR(_bizCd) {
        var _url = '<%=path%>/customer/cstbscinfo/toCstGuarDynamicPage.do';
        //如果有参数则在第二个参数中传入
        $("#cstGuarDynamicBizdiv").load(_url, {bizCd: _bizCd}, function (responseText, textStatus) {
            //dynamicCstRlTypBizPageUIInst();//重新设置字段样式,本方法应该在动态页面中自己根据动态字段写好
            $("#formSet1").check_ligerFormEditor();
            var form = new liger.get("formSet1");
            form.setData({
                guarTypCd: tempGuarTypCd,
                guarAmt: tempGuarAmt
            });
        });

        //重新赋值使用
        _url = '<%=path%>/customer/cstbscinfo/toCstGuarDynamicPageForCorp.do';
        //如果有参数则在第二个参数中传入
        $("#cstGuar1DynamicBizdiv").load(_url, {bizCd: _bizCd}, function (responseText, textStatus) {
            $("#formSet1").check_ligerFormEditor();//重新刷新页面动态字段
            var form = new liger.get("formSet1");
            form.setData({
                mchr9: tempMchr9
            });
        });
    }

    //保存事件
    function saveEvent() {
        $("#saveBtn1").click(function (event) {
            var form = liger.get("formSet1");
            if (!form.valid()) {
                $.ligerDialog.SQalert({content: LogUtils.LOG_CMM_MUST_FIX_ITEM_INFO, SQ_type: "warning"});
                return false; //验证不通过，不执行以下代码
            }
            //中征码验证
            var loanCardCd = $("#loanCardCd").val();
            var id = $("#cId").val();
            var loanCardCdflag = true;
            $.ajax({
                type: 'post',
                async:false,
                dataType:'json',
                data:{loanCardCd:loanCardCd,
                id:id},
                url: '<%=path%>/customer/cstbscinfo/checkLoanCardNo.do',
                success:function(msg){
                    if(msg.success != 1){
                        $.ligerDialog.SQalert({content: msg.info,SQ_type: "warning"});
                        loanCardCdflag = false;
                    }
                }
            });
            if(!loanCardCdflag){
                return false;
            }
            //税务登记号验证
            var taxRegNo = $("#taxRegNo").val();
            /*var taxRegNoflag = false;
            if($("#certTypCd").val() == '91'){//社会统一代码
                taxRegNoflag = CheckSocialCreditCodeOrg(taxRegNo);
            }else{//税务登记证
                taxRegNoflag = checkTaxpayerId(taxRegNo);
            }
            if(!taxRegNoflag){
                $.ligerDialog.SQalert({content: "税务登记证格式错误",SQ_type: "warning"});
                return false;
            }*/
            getDataList();
            //alert(dataList);
            //return;
            if (checkFlag == 1) {
                return;
            }
            var data = form.getData();
            //验证手机三要素-REQ-3424
			var lowerMp1_aft = "";
            $("#rows tr").each(function () { //获取法人手机号
                if ($(this).find("#mTypCd").val() == '1') {
                	lowerMp1_aft = $(this).find("#teamMp1").val();
                }
            });
			if(lowerMp1_bef != lowerMp1_aft){
				data["lowerMp1"] = lowerMp1_aft;
	            var cfcaFlag = checkThreeElements(data);
	           	if(cfcaFlag == 0){
	               	return ;
	    		}
			}
            data["dataList"] = dataList;
            data["regDt"] = $("#regDt").val();
            data["expDt"] = $("#expDt").val();
            //data["corpRepBd"] = $("#corpRepBd").val();
            var url = '<%=path%>/customer/cstbscinfo/addCorp.do';
            if (id != "") { //修改
                url = '<%=path%>/customer/cstbscinfo/modifyCorp.do';
                data["id"] = id;
            }

            var docArray = JSON.stringify(getUploadResultParams());

            /* if(docArray != "[]"){
            	UIUtils.alertWarning("您有未上传的附件");
            	return;
            } */
            //赋值附件
            data["docArray"] = docArray;

            //请求
            AjaxUtils.ajaxPost(url, data, function (msg) {
                if (msg.success == 1) {
                    checkFlag = 0;
                    UIUtils.alertSuccess(msg.info);
                    if (msg.data) {
                        $("#cId").val(msg.data);
                        refreshUlFileRecListByPkId(msg.data, "CST_BSC_INFO");
                    }
                    pageInApp.flag = false;
                    isAdd = true;
                    $("#openLockBtn").hide();
                    //刷新附件页面GRID方法和清空上传按钮
                    clearUploadResultParams();
                    var tabid = top.tab.getSelectedTabItemID();
                    Add_navTab('tab_customer_corp_update'+ new Date().getTime() +$("#cId").val(),'修改客户','<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpAddPage.do?id='+$("#cId").val());
                    top.tab.removeTabItem(tabid);
                } else {
                    UIUtils.alertError(msg.info);
                }
            }, true);
        });
    }
    var toAddFlag = '${toAddFlag}';
    //初始化Tab页
    function initTab() {
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: GET_minIframeHeight(),
            onBeforeSelectTabItem: function (tabid) {
                var _cId = $("#cId").val();
                if (tabid != "tabA" && tabid!="tabK") {
                    if (pageInApp.flag) {
                        $.ligerDialog.SQalert({content: LogUtils.LOG_CUST_CONFIRM_HERE_HAS_INFO, SQ_type: "warning"});
                        return false;
                    }
                }
            },
            onAfterSelectTabItem: function (tabid) {
                if (loadedTabs.indexOf(tabid) < 0) {
                    //获取客户ID供其它页面使用
                    var _cId = $("#cId").val();
                    var _cstNm = $("#cstNm").val();
                    if (tabid != "tabA") {
                        if (!_cId) {
                            $.ligerDialog.SQalert({
                                content: LogUtils.LOG_CUST_CONFIRM_HERE_HAS_INFO,
                                SQ_type: "warning"
                            });
                            return false; //请确定客户信息存在后在操作！
                        }
                    }
                    loadedTabs.push(tabid);
                    switch (tabid) {
                        case "tabB":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpEpRecordPage.do?cstId=" + _cId);
                            break;
                        case "tabH":
                            var parms = "?cstId=" + _cId + "&cstNm=" + _cstNm;
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstbscinfo/toCstProjectPage.do" + parms);
                            break;
                        case "tabC":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstbscinfo/toCustCstBacInfoEpAssetPage.do?cstId=" + _cId);
                            break;
                        case "tabD":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstbscinfo/toCstCreditPage.do?cstId=" + _cId);
                            break;
                        case "tabE":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstbscinfo/toFilFinanceDebtPage.do?cstId=" + _cId);
                            break;
                        case "tabF":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstmidmaninfo/toListPage.do?cstId=" + _cId);
                            break;
                        case "tabG":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstcommrec/toListPage.do?cstId=" + _cId);
                            break;
                        case "tabI":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpBankAccPage.do?cstId=" + _cId);
                            break;
                        case "tabK":
                            var parms = "?cstId=" + _cId + "&cstNm=" + _cstNm + "&toAddFlag=" + toAddFlag;
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/risk/rskCstSignLog/toListPage.do" + parms);
                            break;
                        case "tabL":
                            var parms = "?Id=" + _cId + "&useType=1&cstType=2";
                            pageInTab.setTabItemSrc(tabid,"<%=path%>/customer/cstManualRelation/toListPage.do"+parms);
                            break;
                    }
                }
                ;
                SetIframe_height();
            }
        });

        $.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
    };
    function selectTab() {
        if (toAddFlag == 'true') {
            pageInTab.selectTabItem("tabK");
        }
    }

    //初始化表单
    function initForm() {
        ligerPersonForm = $("#formSet1").ligerForm({
            validate: true
        });
        $("#formSet1").check_ligerFormEditor();//重新刷新页面动态字段
    };

    //客户类型切换事件
    function customerTypeChangeEvent() {
        var customerType_val = $("[name=customerTYPE]:checked").val();
        $("[name=customerTYPE]").click(function (event) {
            var Rval = $(this).ligerGetRadioManager().input.val();
            if (customerType_val == Rval) return;

            $.ligerDialog.SQconfirm(LogUtils.LOG_CUST_SWAP_TAB_BASE_INFO, function (flag) {
                if (flag == false) {
                    //RADIO 重新选择回到企业
                    $("input[name='customerTYPE'][value=2]").prev(".l-radio").click();
                    return;
                }
                ;
                customerType_val = Rval;
                var tabid = "addnewCustomer";
                var url;
                switch (Rval) {
                    case "2":
                        url = "<%=path%>/customer/cstbscinfo/toCustCstBacInfoCorpAddPage.do";
                        break;
                    case "1":
                        url = "<%=path%>/customer/cstbscinfo/toCustCstBacInfoNpAddPage.do";
                        break;
                }
                if (parent.parent && parent.parent.mainApp && parent.parent.mainApp.parentTab) {
                    var navTab = parent.parent.mainApp.parentTab;
                    navTab.setTabItemSrc(tabid, url);
                }
                ;
            });
        });
    };

    //修改初始化数据
    //只为了动态表单赋值使用,动态表单的数据只有在加载完成后才可以赋值
    var tempGuarTypCd;
    var tempGuarAmt;
    var indCdVal;//所属行业
    var stdIndCd;//标准经济行业分类
    var stdIndCdInitPass = false;//判断标准行业分类是否已经初始化完成,这样可以赋值
    var tempMchr9;//担保人-股东关系
    var ligerPersonForm;

    var lowerMp1_bef = ""; //法人手机号-页面初始值
    function initData() {
        var _id = $("#cId").val();

        $("#isInst").val(0);

        if (!_id) {
            $("input[initNm='initTeamNm']").val("${lowerCstNm }");
            $("input[initNo='initTeamCertNo']").val("${lowerCertNo }");
            $("input[initNo='initTeamCertNo']").attr("disabled", "disabled");
            $("input[initNm='initTeamNm']").attr("disabled", "disabled");
            $("select[initTyp='initTyp']").attr("disabled", "disabled");
            $("select[initTyp='initTyp']").val("${corpForCertTypCd }");
            return;
        }

        $("#rows tr").each(function () {
            if ($(this).find("#mTypCd").val() == '1') {
                $(this).find("#teamNm").attr("disabled", "disabled");
                $(this).find("#teamCertNo").attr("disabled", "disabled");
                $(this).find("#tcorpForCertTypCd").attr("disabled", "disabled");
                //设置法人手机号不可修改-REQ-3424
                lowerMp1_bef = $(this).find("#teamMp1").val();
                if (lowerMp1_bef) { //不为空
                	$(this).find("#teamMp1").attr("disabled", "disabled");
                }
            }
        });

        var _url = '<%=path%>/customer/cstbscinfo/getById.do';
        AjaxUtils.ajaxGet(_url, {id: _id}, function (msg) {
            if (msg.success == 1) {
                setData(msg.data);//设置数据
                tempData = msg.data;
                pageInApp.flag = false;
                if (!msg.data.certTypCd == "c") {
                    disableBeforeItem();//禁用证件号
                }
                disableCustomerTYPE();
            } else {
                UIUtils.alertError(msg.info);
            }
        }, false);
    }

    //设置页面数据
    function setData(data) {
        var form = new liger.get("formSet1");
        form.setData({
            cstLvlCd: data.cstLvlCd,
            corpTypCd: data.cstCorpBscInfoVO.corpTypCd,
            regCapUntCd: data.cstCorpBscInfoVO.regCapUntCd,
            paidCapUntCd: data.cstCorpBscInfoVO.paidCapUntCd,
            othIndCd: data.othIndCd,
            cstCd: data.cstCd,
            cstNm: data.cstNm,
            payTypCd: data.payTypCd,
            //corpRep:data.cstCorpBscInfoVO.corpRep,
            taxRegNo: data.cstCorpBscInfoVO.taxRegNo,
            bizLicNo: data.cstCorpBscInfoVO.bizLicNo,
            regCapAmt: data.cstCorpBscInfoVO.regCapAmt,
            oldRegCapAmt: data.cstCorpBscInfoVO.regCapAmt,
            paidCapAmt: data.cstCorpBscInfoVO.paidCapAmt,
            zipNo: data.cstCorpBscInfoVO.zipNo,
            websit: data.cstCorpBscInfoVO.websit,
            bizScope: data.cstCorpBscInfoVO.bizScope,
            officeAddr: data.cstCorpBscInfoVO.officeAddr,
            regAddr: data.cstCorpBscInfoVO.regAddr,
            postAddr: data.cstCorpBscInfoVO.postAddr,
            othInfo: data.cstCorpBscInfoVO.othInfo,
            cstRem: data.cstRem,
            certNo: data.certNo,
            certTypCd: data.certTypCd,
            cstStsCd: data.cstStsCd,
            mp: data.mp,
            shtNm: data.cstCorpBscInfoVO.shtNm,
            //succ:data.cstCorpBscInfoVO.succ,
            corpTax: data.cstCorpBscInfoVO.corpTax,
            regTel: data.cstCorpBscInfoVO.regTel,
            empQtyCd: data.cstCorpBscInfoVO.empQtyCd,
            officeTel: data.cstCorpBscInfoVO.officeTel,
            officeArea: data.cstCorpBscInfoVO.officeArea,
            prpAttr: data.cstCorpBscInfoVO.prpAttr,
            loanCardNo: data.cstCorpBscInfoVO.loanCardNo,
            loanCardPwd: data.cstCorpBscInfoVO.loanCardPwd,
            loanCardCd: data.cstCorpBscInfoVO.loanCardCd,
            loanAss: data.cstCorpBscInfoVO.loanAss,
            guarTypCd: data.cstCorpBscInfoVO.guarTypCd,
            guarAmt: data.cstCorpBscInfoVO.guarAmt,
            isInst: data.cstCorpBscInfoVO.isInst,
            perMitNo: data.cstCorpBscInfoVO.perMitNo,
            regStdProvCd: data.cstCorpBscInfoVO.regProvCd,
            regStdCityCd: data.cstCorpBscInfoVO.regCityCd,
            regStdDistCd: data.cstCorpBscInfoVO.regDistCd,
            loanCardCd: data.cstCorpBscInfoVO.loanCardCd,
            prpVal: data.cstCorpBscInfoVO.prpVal
        });

        //设置回显标准省市县
        setSysStdProvCdUpdateValue(data.cstCorpBscInfoVO.regProvCd);//省
        setSysStdCityCdUpdateValue(data.cstCorpBscInfoVO.regCityCd);//市
        setSysStdDistCdUpdateValue(data.cstCorpBscInfoVO.regDistCd);//县
        //设置完回显值执行省市县变更事件
        setSysStdProvCdChange();
        setSysStdCityCdChange();

        stdIndCd = data.cstCorpBscInfoVO.stdIndCd;
        indCdVal = data.indCd;
        if (indCdVal) {
            var indCdTreeSelect = liger.get("indCd");
            if (indCdTreeSelect) {
                indCdTreeSelect.setValue(indCdVal);
            }
        }

        if (stdIndCd) {
            var stdIndCdTreeSelect = liger.get("stdIndCd");
            if (stdIndCdTreeSelect && stdIndCdInitPass == true) {
                stdIndCdTreeSelect.setValue(stdIndCd);
            }
        }

        if (data.cstCorpBscInfoVO.regDt) {
            var date = new Date(data.cstCorpBscInfoVO.regDt);
            var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
            $("#regDt").val(dateStr);
        }
        if (data.cstCorpBscInfoVO.expDt) {
            var date = new Date(data.cstCorpBscInfoVO.expDt);
            var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
            $("#expDt").val(dateStr);
        }
        if (data.cstCorpBscInfoVO.corpRepBd) {
            var date = new Date(data.cstCorpBscInfoVO.corpRepBd);
            var dateStr = DateUtils.formatDate(date, DateUtils.YYYY_MM_DD);
            $("#corpRepBd").val(dateStr);
        }

        $("#cstRlTyp").ligerGetComboBoxManager().setValue(data.cstRlAttr);
        //set customer rlattr
        if (data.cstRlAttrVOList) {
            form.setData({
                prjCtrlCd: data.prjCtrlCd
            });
        }
        //设置法定代表人名称和身份证号码
        if (data.cstCorpBscInfoVO.cstCorpTeamVO) {
            form.setData({
                lowerCstNm: data.cstCorpBscInfoVO.cstCorpTeamVO.mnm,
                corpForCertTypCd: data.cstCorpBscInfoVO.cstCorpTeamVO.certTypCd,
                lowerCertNo: data.cstCorpBscInfoVO.cstCorpTeamVO.certNo
            });
        }

        //辅助信息
        if (data.cstExtInfoVO) {
            tempGuarTypCd = data.cstExtInfoVO.schr6;
            tempGuarAmt = data.cstExtInfoVO.num9;
            tempGuarAmt = NumberUtils.isScientificNotationToString(tempGuarAmt);
            tempMchr9 = data.cstExtInfoVO.mchr9;
            form.setData({
                ext_schr1: data.cstExtInfoVO.schr1,
                ext_schr2: data.cstExtInfoVO.schr2,
                ext_schr3: data.cstExtInfoVO.schr3,
                ext_schr4: data.cstExtInfoVO.schr4,
                ext_schr5: data.cstExtInfoVO.schr5,
                ext_schr6: data.cstExtInfoVO.schr6,
                ext_mchr1: data.cstExtInfoVO.mchr1,
                ext_mchr2: data.cstExtInfoVO.mchr2,
                ext_mchr3: data.cstExtInfoVO.mchr3,
                ext_mchr4: data.cstExtInfoVO.mchr4,
                ext_mchr5: data.cstExtInfoVO.mchr5,
                ext_mchr6: data.cstExtInfoVO.mchr6,
                ext_mchr7: data.cstExtInfoVO.mchr7,
                ext_mchr8: data.cstExtInfoVO.mchr8,
                mchr9: data.cstExtInfoVO.mchr9,
                ext_bchr1: data.cstExtInfoVO.bchr1,
                ext_bchr2: data.cstExtInfoVO.bchr2,
                ext_num1: data.cstExtInfoVO.num1,
                ext_num2: data.cstExtInfoVO.num2,
                ext_num3: data.cstExtInfoVO.num3,
                ext_num4: data.cstExtInfoVO.num4,
                ext_num5: data.cstExtInfoVO.num5,
                ext_num6: data.cstExtInfoVO.num6,
                ext_num7: data.cstExtInfoVO.num7,
                ext_num8: data.cstExtInfoVO.num8,
                ext_num9: data.cstExtInfoVO.num9
            });
        }
        if (data.certTypCd == "c") {
            liger.get("certTypCd").setEnabled(true);
            liger.get("certNo").setEnabled(true);
            $("#certNo").val("");
        }

    };

    //初始化按钮
    function initBtn() {
        $("#openLockBtn").hide();
    }


    //解锁事件
    function openLockBtn() {
        //解锁客户名称和证件号字段数据,解锁要判断客户是否已经新增完成,如果完成则不能修改
        $("#openLockBtn").click(function (event) {
            var _cId = $("#cId").val();
            if (_cId && isAdd == true) {
                $.ligerDialog.SQalert({content: "客户信息已经保存,不能解锁!", SQ_type: "warning"});
                return; //验证不通过，不执行以下代码
            }
            openLock();
        });
    };

    //解锁
    function openLock() {
        liger.get("certNo").setEnabled(true);
        $("#openLockBtn").hide();
        $("#cId").val("");
        pageInApp.flag = true;//tab页验证关闭
        $.ligerDialog.SQalert({content: LogUtils.LOG_CUST_LOCK_OPEN_SUCC, SQ_type: "success"});
    }

    //身份证件录入后需要调用后台查看用户信息是否存在,存在则提示是否要获取
    function certNoKeyUpEvent() {
        $("#certNo").change(function (event) {//如果身份证已经输入完成(15或18位)后, 如果用户名称存在则则后台判断是否存在
            var val = $(this).val();
            checkExistInfo();
        });
    };

    //检查是否存在客户信息
    function checkExistInfo() {
        var wait_dialog = $.ligerDialog.SQalert({
            content: LogUtils.LOG_CMM_LOADING,
            SQ_type: "waitting",
            onClose: function () {
            }
        });

        var _certNo = $("#certNo").val();
        var _url = '<%=path%>/customer/cstbscinfo/getExistCorp.do';
        $.ajax({
            type: 'get',
            dataType: 'json',
            data: {certNo: _certNo},
            url: _url,
            success: function (msg) {
                wait_dialog.close();
                if (msg.success == 1) {
                    $.ligerDialog.SQconfirm(LogUtils.LOG_CUST_INFO_EXIST, function (flag) {
                        $("#cId").val(msg.data.cId);//设置数据
                        if (flag == true) {
                            initData();
                        }//不带入信息则需要锁定用户名和密码,因为数据已经存在已经不需要在验证身份证信息了
                        pageInApp.flag = false;//tab页验证关闭
                        //设置客户名称
                        $("#cstNm").val(msg.data.cstNm);
                        //禁用用户名和身份证号码
                        disableVIDInfo();
                        enableAfterItem();
                        $("#openLockBtn").show();
                    });
                } else {
                    $("#cId").val("");
                    enableAfterItem();
                    $("#openLockBtn").hide();
                    //$.ligerDialog.SQalert({content: msg.info,SQ_type: "error"});
                }
            }
        });
    };

    //禁用客户类型选项
    function disableCustomerTYPE() {
        if ($("[name=customerTYPE]")) {//特殊情况使用
            var obj = $("[name=customerTYPE]");
            obj.setDisabled_ligerRadio(true);
        }
        ;
    }

    //禁用主要信息
    function disableVIDInfo() {
        liger.get("certNo").setDisabled(true);
    }

    //新增禁用字段
    function disableBeforeItem() {
        //如果是修改操作则不做操作
        var cId = $("#cId").val();
        if (cId) {
            liger.get("certNo").setDisabled(true);
            return;
        }
        chahgeItemStatus(true);
    };

    //新增启用字段
    function enableAfterItem() {
        chahgeItemStatus(false);
    };


    //通过true(禁用) false(启用)
    function chahgeItemStatus(tf) {
        if (liger.get("cstLvlCd")) {
            var obj = liger.get("cstLvlCd");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("corpTypCd")) {
            var obj = liger.get("corpTypCd");
            tf == true ? obj.setEnabled() : obj.setEnabled();
        }
        ;
        if (liger.get("regCapUntCd")) {
            var obj = liger.get("regCapUntCd");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("paidCapUntCd")) {
            var obj = liger.get("paidCapUntCd");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("indCd")) {
            var obj = liger.get("indCd");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("cstCd")) {
            var obj = liger.get("cstCd");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        /* if(liger.get("corpRep")){
            var obj = liger.get("corpRep");
            tf==true?obj.setDisabled(tf):obj.setEnabled();
        }; */
        if (liger.get("taxRegNo")) {
            var obj = liger.get("taxRegNo");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("bizLicNo")) {
            var obj = liger.get("bizLicNo");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("regCapAmt")) {
            var obj = liger.get("regCapAmt");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("paidCapAmt")) {
            var obj = liger.get("paidCapAmt");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("zipNo")) {
            var obj = liger.get("zipNo");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("websit")) {
            var obj = liger.get("websit");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("bizScope")) {
            var obj = liger.get("bizScope");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("officeAddr")) {
            var obj = liger.get("officeAddr");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("regAddr")) {
            var obj = liger.get("regAddr");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("postAddr")) {
            var obj = liger.get("postAddr");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("othInfo")) {
            var obj = liger.get("othInfo");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if ($("#cstRem")) {
            var obj = $("#cstRem");
            tf == true ? obj.setDisabled_ligerTextarea(tf) : obj.setDisabled_ligerTextarea(tf);
        }
        ;
        if (liger.get("cstStsCd")) {
            var obj = liger.get("cstStsCd");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("mp")) {
            var obj = liger.get("mp");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("shtNm")) {
            var obj = liger.get("shtNm");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        /* if(liger.get("succ")){
            var obj = liger.get("succ");
            tf==true?obj.setDisabled(tf):obj.setEnabled();
        }; */
        if (liger.get("corpTax")) {
            var obj = liger.get("corpTax");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("regTel")) {
            var obj = liger.get("regTel");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("empQtyCd")) {
            var obj = liger.get("empQtyCd");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("regDt")) {
            var obj = liger.get("regDt");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("expDt")) {
            var obj = liger.get("expDt");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("corpRepBd")) {
            var obj = liger.get("corpRepBd");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;

        //附加信息
        if (liger.get("ext_schr1")) {
            var obj = liger.get("ext_schr1");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_schr2")) {
            var obj = liger.get("ext_schr2");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_schr3")) {
            var obj = liger.get("ext_schr3");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_schr4")) {
            var obj = liger.get("ext_schr4");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_schr5")) {
            var obj = liger.get("ext_schr5");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_mchr1")) {
            var obj = liger.get("ext_mchr1");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_mchr2")) {
            var obj = liger.get("ext_mchr2");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_mchr3")) {
            var obj = liger.get("ext_mchr3");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_mchr4")) {
            var obj = liger.get("ext_mchr4");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_mchr5")) {
            var obj = liger.get("ext_mchr5");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_mchr6")) {
            var obj = liger.get("ext_mchr6");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_mchr7")) {
            var obj = liger.get("ext_mchr7");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_mchr8")) {
            var obj = liger.get("ext_mchr8");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_bchr1")) {
            var obj = liger.get("ext_bchr1");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_bchr2")) {
            var obj = liger.get("ext_bchr2");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_bchr3")) {
            var obj = liger.get("ext_bchr3");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num1")) {
            var obj = liger.get("ext_num1");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num2")) {
            var obj = liger.get("ext_num2");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num3")) {
            var obj = liger.get("ext_num3");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num4")) {
            var obj = liger.get("ext_num4");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num5")) {
            var obj = liger.get("ext_num5");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num6")) {
            var obj = liger.get("ext_num6");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num7")) {
            var obj = liger.get("ext_num7");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num8")) {
            var obj = liger.get("ext_num8");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num9")) {
            var obj = liger.get("ext_num9");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num10")) {
            var obj = liger.get("ext_num10");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num11")) {
            var obj = liger.get("ext_num11");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num12")) {
            var obj = liger.get("ext_num12");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num13")) {
            var obj = liger.get("ext_num13");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num14")) {
            var obj = liger.get("ext_num14");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
        if (liger.get("ext_num15")) {
            var obj = liger.get("ext_num15");
            tf == true ? obj.setDisabled(tf) : obj.setEnabled();
        }
        ;
    }

    //设置禁用字段
    function disabledField() {
        liger.get("certTypCd").setDisabled(true);
        liger.get("corpForCertTypCd").setDisabled(true);
        var _cId = $("#cId").val();

        if(_cId){
            //营业执照注册号 修改时不为空不可编辑
            var _bizLicNo = liger.get("bizLicNo").getValue();
            if(!_bizLicNo){
                liger.get("bizLicNo").setDisabled(true);
            }
            //税务登记证 修改时不为空不可编辑
            var _taxRegNo = liger.get("taxRegNo").getValue();
            if(!_taxRegNo){
                liger.get("taxRegNo").setDisabled(true);
            }
            //中征码 修改时不为空不可编辑
            var _loanCardCd =liger.get("loanCardCd").getValue();
            if(!_loanCardCd){
                liger.get("loanCardCd").setDisabled(true);
            }
        }
    }

    //身份证第三方验证事件
    function npVerifyIDEvent(verify) {
        $.ajax({
            type: 'post',
            async: false,
            dataType: 'json',
            data: {verify: verify},
            url: '<%=path%>/customer/cstbscinfo/validateIdCards.do',
            success: function (msg) {
                if (msg.success == 1) {
                    checkFlag = 0;
                } else {//验证未通过
                    UIUtils.alertWarning(msg.info);
                    checkFlag = 1;
                }
            }
        });
    };

    $("#cst_corp_team_add_btn_id").click(function (event) {
        $("#rows").append('<tr><td class="td"><div><select name="mTypCd" id="mTypCd"> <c:forEach items="${searchSelectMTypCdList }" var="kv" begin="0" step="1" varStatus="status"><c:if test="${kv.key != 1}"><option value="${kv.key }">${kv.value }</option></c:if></c:forEach></select></div></td><td class="td"><div><input name="teamNm" id="teamNm" type="text" value=""></div></td><td class="td"><div><select name="tcorpForCertTypCd" id="tcorpForCertTypCd"><c:forEach items="${searchSelectCertTypCdForNpList }" var="kv" begin="0" step="1" varStatus="status"><c:if test="${status.index == 0}"><option value="${kv.key }" checked >${kv.value }</option></c:if><c:if test="${status.index != 0}"><option value="${kv.key }">${kv.value }</option></c:if></c:forEach></select></div></td><td class="td"><div><input name="teamCertNo" id="teamCertNo" type="text" value="" ></div></td><td class="td"><div><input name="teamMp1" id="teamMp1" type="text" value="" ></div></td><td class="td"><div><a class="sq-button-hasicon" style="cursor:pointer" onclick="deleteRow(this)"><i class="sqBtnIco_7"></i>删除</a></div></td></tr>');
    });

    function deleteRow(owner) {
        var ctId = $(owner).parent().parent().parent().find("#teamId").val();
        if (ctId != undefined) {
            $.ligerDialog.SQconfirm(LogUtils.LOG_CMM_DELETE_CONFIRM, function (flag) {
                if (flag == false) return;
                var _url = '<%=path%>/customer/cstcorpteam/removeById.do';
                AjaxUtils.ajaxPost(_url, {id: ctId}, function (msg) {
                    if (msg.success == 1) {
                        $(owner).parent().parent().parent().remove();
                        UIUtils.alertSuccess(msg.info);
                    } else {
                        UIUtils.alertError(msg.info);
                    }
                }, true);
            });
        } else {
            $(owner).parent().parent().parent().remove();
        }
    }

    function getDataList() {
        dataList = "";
        var verify = "";
        $("#rows tr").each(function () {
            verify += $(this).find("#teamNm").val() + ".,";
            verify += $(this).find("#teamCertNo").val() + ".,";
            verify += $(this).find("#tcorpForCertTypCd").val() + ".@";
            if (($(this).find("#teamId").val()) != undefined) {
                dataList += $(this).find("#teamId").val() + ".,";
            } else {
                dataList += ".,";
            }
            dataList += $(this).find("#mTypCd").val() + ".,";
            dataList += $(this).find("#teamNm").val() + ".,";
            dataList += $(this).find("#teamCertNo").val() + ".,";
            dataList += $(this).find("#teamMp1").val() + ".,";
            dataList += $(this).find("#tcorpForCertTypCd").val() + ".@";
        });
        npVerifyIDEvent(verify);
    }
    //校验统一社会信用编码
    function CheckSocialCreditCodeOrg(Code) {
        var patrn = /^[0-9A-Z]+$/;
        //18位校验及大写校验
        if ((Code.length != 18) || (patrn.test(Code) == false))
        {
            return false;
        }
        else
        {
            var Ancode;//信用代码/税号的每一个值
            var Ancodevalue;//信用代码/税号每一个值的权重
            var total = 0;
            var weightedfactors = [1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28];//加权因子
            var str = '0123456789ABCDEFGHJKLMNPQRTUWXY';
            //不用I、O、S、V、Z
            for (var i = 0; i < Code.length - 1; i++)
            {
                Ancode = Code.substring(i, i + 1);
                Ancodevalue = str.indexOf(Ancode);
                total = total + Ancodevalue * weightedfactors[i];
                //权重与加权因子相乘之和
            }
            var logiccheckcode = 31 - total % 31;
            if (logiccheckcode == 31)
            {
                logiccheckcode = 0;
            }
            var Str = "0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F,G,H,J,K,L,M,N,P,Q,R,T,U,W,X,Y";
            var Array_Str = Str.split(',');
            logiccheckcode = Array_Str[logiccheckcode];


            var checkcode = Code.substring(17, 18);
            if (logiccheckcode != checkcode)
            {
                return false;
                // alert("不是有效的统一社会信用编码！");
            }else{
                return true;
            }
        }
    }

    //税人识别号验证 (1)
    function checkTaxpayerId(taxpayerId){
        if(taxpayerId!="" && taxpayerId.length===15){
            var addressCode = taxpayerId.substring(0,6);
            // 校验地址码
            var check = checkAddressCode(addressCode);
            if(!check){
                return false;
            }
            // 校验组织机构代码
            var orgCode = taxpayerId.substring(6,9);
            check = isValidOrgCode(orgCode);
            if(!check){
                return false;
            }
            return true;
        }else{
            return false;
        }
    }
    //税人识别号验证 (2)
    function isValidOrgCode(value){
        if(value!=""){
            var part1=value.substring(0,8);
            var part2=value.substring(value.length-1,1);
            var ws = [3, 7, 9, 10, 5, 8, 4, 2];
            var str = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ';
            var reg = /^([0-9A-Z]){8}$/;
            if (!reg.test(part1))
            {
                return true
            }
            var sum = 0;
            for (var i = 0; i< 8; i++)
            {
                sum += str.indexOf(part1.charAt(i)) * ws[i];
            }
            var C9 = 11 - (sum % 11);
            var YC9=part2+'';
            if (C9 == 11) {
                C9 = '0';
            } else if (C9 == 10) {
                C9 = 'X' ;
            } else {
                C9 = C9+'';
            }
            return YC9!=C9;
        }
    }

    //税人识别号验证 (3)
    function checkAddressCode(addressCode){
        var provinceAndCitys={11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",21:"辽宁",22:"吉林",23:"黑龙江",
            31:"上海",32:"江苏",33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",42:"湖北",43:"湖南",44:"广东",
            45:"广西",46:"海南",50:"重庆",51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",63:"青海",64:"宁夏",
            65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"};
        var check = /^[1-9]\d{5}$/.test(addressCode);
        if(!check) return false;
        if(provinceAndCitys[parseInt(addressCode.substring(0,2))]){
            return true;
        }else{
            return false;
        }

    }

	//验证手机三要素真实性-REQ-3424
	function checkThreeElements(data){
		var cfcaFlag = 0;
		var userName = data.lowerCstNm; //用户名
		var identificationNo = data.lowerCertNo; //用户证件号
		var mobilePhone = data.lowerMp1; //手机号
		//手机号为空-不验证
		if(!mobilePhone){
			cfcaFlag = 1;
		}else{
			var params = {userName:userName, identificationNo:identificationNo, mobilePhone:mobilePhone};
			var _url = '<%=path%>/customer/cstbscinfo/checkThreeElements.do';
			$.ajax({
	    		type:'get',
	    		dataType:'json',
	    		async:false,
	    		url:_url,
	    		data:params,
	    		success:function(msg){
	    			if(msg.success == 1){//验证通过
						cfcaFlag = 1;
					}else if(msg.success == 0){//验证不通过
						cfcaFlag = 0;
						UIUtils.alertWarning("法人手机三要素：" + msg.info);
					}
	    		},
	    		error:function(msg){
	    			UIUtils.alertError(msg.info);
	    		}
	    	});
		}
		return cfcaFlag;
	}

    // 营业执照注册号
    $.validator.addMethod("checkBizLicNo", function (value, element) {
        debugger
        var reg1 = /^\d{15}$/;
        var reg2=/^[A-Z,a-z,0-9]{18}$/;
        return reg1.test(value) || reg2.test(value);
    }, "营业执照注册号格式错误!");

    // 税务登记证
    $.validator.addMethod("checkTaxRegNo", function (value, element) {
        debugger
        var reg1 = /^\d{15}$/;
        var reg2=/^[A-Z,a-z,0-9]{18}$/;
        return reg1.test(value) || reg2.test(value);
    }, "税务登记证号格式错误!");

    // 开户许可证核准号
    $.validator.addMethod("checkPerMitNo", function (value, element) {
        var telReg = /^[A-Z,a-z]\d{13}$/;
        return this.optional(element) || telReg.test(value);
    }, "开户许可证核准号格式错误!");
</script>
</body>
</html>